package discount;


import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import java.sql.*;

import service.CommonServlet;

public class DownloadDiscount extends CommonServlet {

	protected void execute(HttpServletRequest request,
			HttpServletResponse response) throws ServletException,
			IOException{
		try
		{
			int dId = Integer.parseInt(request.getParameter("dId"));
			if(dId==0) throw new Exception("dId can't be empty ");
		
			String sql1="insert into buy_discount values (null,curdate(),?,?)";
			
			PreparedStatement pstmt = mConnection.prepareStatement(sql1);
			pstmt.setInt(1,uNo);
			pstmt.setInt(2,dId);
			
			int result1 = pstmt.executeUpdate();
			response.getWriter().println(result1);
			
			
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
	
	public DownloadDiscount()
	{super();
	}
	
}